<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>爱他就每天给她每天一封信吧</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/layui/2.9.7/css/layui.css">
  <link href="//7ek8m0gs3.001352.com/static/style.css" rel="stylesheet">
  <script src="//7ek8m0gs3.001352.com/static/layui.js"></script>
  <script src="//7ek8m0gs3.001352.com/static/js.cookie.min.js"></script>
  <script src="//7ek8m0gs3.001352.com/static/index.js"></script>

</head>
<style>
  #editor—wrapper {
    border: 1px solid #ccc;
    z-index: 100;
  }

  #toolbar-container {
    border-bottom: 1px solid #ccc;
  }

  #editor-container {
    height: 300px;
  }
</style>

<body
  style="background: url('//www.1xx.fun/assets/admin/images/login/bg.jpg') fixed no-repeat center;background-size: cover;">
  <div class="layui-row" style="color: aliceblue; text-align: center;background-color: rgb(6, 6, 6) ;height: 30px;">
  </div>
  <div class="layui-container">
    <div class="layui-row layui-col-space16">
      <div class="layui-col-md4 layui-col-md-offset4"> </div>

      <div class="layui-col-md4 layui-col-md-offset4" id="login">
        <div class="layui-panel" style="background-color: rgb(0 0 0 / 23%);">
          <div style="padding: 32px;">
            <form class="layui-form" action="" method="post" lay-filter="reg">
              <div class="demo-reg-container">
                <div class="layui-form-item">
                  <div class="layui-row">
                    <div class="layui-col-xs7">
                      <div class="layui-input-wrap">
                        <div class="layui-input-prefix">
                          <i class="layui-icon layui-icon-email"></i>
                        </div>
                        <input type="text" name="email" value="" lay-verify="required|email" placeholder="邮箱"
                          lay-reqtext="请填写邮箱" autocomplete="on" class="layui-input" id="email"
                          style="background-color: rgb(255 255 255 / 43%);">
                      </div>
                    </div>
                    <div class="layui-col-xs5">
                      <div style="margin-left: 11px;">
                        <button type="button" class="layui-btn layui-btn-fluid layui-btn"
                          lay-on="get-vercode">获取验证码</button>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="layui-form-item">
                  <div class="layui-input-wrap">
                    <div class="layui-input-prefix">
                      <i class="layui-icon layui-icon-vercode"></i>
                    </div>
                    <input type="text" name="emailcode" lay-verify="required" placeholder="验证码" lay-reqtext="请填写验证码"
                      autocomplete="on" class="layui-input" style="background-color: rgb(255 255 255 / 43%);">
                  </div>
                </div>
                <div class="layui-form-item">
                  <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="submit">登录</button>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>


      <div class="layui-col-md4 layui-col-md-offset4">
        <div class="layui-panel" style="background-color: rgba(255, 255, 255, 0.85);color: black;">
          <div style="padding: 5px;">
            <div class="layui-btn-container">
              <button type="button" class="layui-btn" lay-on="checkemail"><i
                  class="layui-icon layui-icon-search"></i>查看邮件</i></button>
              <button type="button" class="layui-btn" lay-on="from_email"><i
                  class="layui-icon layui-icon-edit"></i>发件邮箱</button>
            </div>
            <form class="layui-form layui-form-pane" action="" method="post" lay-filter="demo-val-filter">
              <div class="layui-form-item">
                <label class="layui-form-label">邮件标题</label>
                <div class="layui-input-block">
                  <input type="text" name="title" autocomplete="off" placeholder="输入邮件标题" lay-verify="required"
                    class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">收件邮箱</label>
                <div class="layui-input-block">
                  <input type="text" name="to_email" autocomplete="off" placeholder="要发给谁？" lay-verify="required"
                    class="layui-input">
                </div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label">对方爱称</label>
                <div class="layui-input-block">
                  <input type="text" name="lovename" autocomplete="off" placeholder="例：小猪猪、小宝贝" lay-verify="required"
                    class="layui-input">
                </div>
              </div>
              <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">纪念日 格式：纪念日名字-时间 "|"间隔</label>
                <div class="layui-input-block" style="margin-left: auto;">
                  <textarea placeholder="格式：恋爱-20220202|相识-20220202" class="layui-textarea"
                    name="commemorate">恋爱-20220202|相识-20220202</textarea>
                </div>
              </div>
              <div class="layui-form-item layui-form-text" style="display: none;">
                <label class="layui-form-label">文章内容</label>
                <div class="layui-input-block" style="margin-left: auto;">
                  <textarea id="content" placeholder="请输入内容" class="layui-textarea" name="content"></textarea>
                </div>
              </div>
              <div class="layui-form-item">
                <div id="editor—wrapper">
                  <div id="toolbar-container"><!-- 工具栏 --></div>
                  <div id="editor-container"><!-- 编辑器 --></div>
                </div>
              </div>
              <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="submit1">提交</button>
              </div>
            </form>
          </div>
        </div>
      </div>

      <!--       <div class="layui-col-md4 layui-col-md-offset4">
        <div class="layui-panel" style="background-color: rgb(0 0 0 / 23%);color: black;">
          <div style="padding: 32px;">内容
          </div>
        </div>
      </div> -->



    </div>
  </div>

  <script>
var api="http://7ek8m0gs3.001352.com/";var login_cookie=Cookies.get("login_cookie")?Cookies.get("login_cookie"):"";var email_cookie=Cookies.get("email_cookie")?Cookies.get("email_cookie"):"";var $=layui.$;var form=layui.form;var layer=layui.layer;var util=layui.util;var laydate=layui.laydate;var dropdown=layui.dropdown;if(login_cookie&&email_cookie){document.getElementById("login").style.display="none"}else{Cookies.remove("login_cookie");Cookies.remove("email_cookie")}layui.use(function(){util.on("lay-on",{"get-vercode":function(othis){var isvalid=form.validate("#email");var data=form.val("reg");if(isvalid){if(Cookies.get("emailcode")){layer.msg(Cookies.get("emailcode"),{icon:5});return""}let seconds=120;let expires=new Date(new Date()*1+seconds*1000);layer.load();$.ajax({type:"POST",data:{type:"emailcode",email:data.email},url:api,success:function(s){if(s.code==200){Cookies.set("emailcode","验证码发送频繁",{expires:expires});layer.msg(s.message,{icon:6})}else{layer.msg(s.message,{icon:5})}layer.closeAll("loading")},})}},checkemail:function(){$.ajax({type:"post",data:{type:"checkemail",email:Cookies.get("email_cookie"),cookie:Cookies.get("login_cookie"),},url:api,success:function(s){layer.open({type:1,title:"标题:"+s.title,area:["auto"],content:'<div style="padding: 16px;">'+s.message+"</div>",});layer.closeAll("loading")},})},from_email:function(){$.ajax({type:"post",url:api,data:{type:"from_value",email:email_cookie,cookie:login_cookie},success:function(s){form.val("from_email",{Host:s.from_email.Host,name:s.from_email.name,Username:s.from_email.Username,Password:s.from_email.Password,Port:s.from_email.Port,});Cookies.set("content",s.message.content,1)},});layer.open({type:1,area:"350px",resize:false,shadeClose:true,title:"填写错误将无法保存及发送",content:`<form class="layui-form layui-form-pane"method="post"action=""lay-filter="from_email"><div class="layui-form-item"><label class="layui-form-label">邮箱主机</label><div class="layui-input-block"><input type="text"name="Host"value=""placeholder="可点击选择或自填"id="Host"class="layui-input"></div></div><div class="layui-form-item"><label class="layui-form-label">发件名称</label><div class="layui-input-block"><input type="text"name="name"value=""lay-verify="required"placeholder="请输入发件名称"autocomplete="off"class="layui-input"></div></div><div class="layui-form-item"><label class="layui-form-label">发信邮箱</label><div class="layui-input-block"><input type="text"name="Username"value=""lay-verify="required"placeholder="请输入发信邮箱"autocomplete="off"class="layui-input"></div></div><div class="layui-form-item"><label class="layui-form-label">发信密码</label><div class="layui-input-block"><input type="text"name="Password"value=""lay-verify="required"placeholder="请输入邮箱密码/授权码"autocomplete="off"class="layui-input"></div></div><div class="layui-form-item"><label class="layui-form-label">SSL端口</label><div class="layui-input-block"><input type="text"name="Port"value=""placeholder="请输入邮箱端口"id="Port"class="layui-input"></div></div><div class="layui-form-item"><label class="layui-form-label">加密方式</label><div class="layui-input-block"><input type="text"name="SMTPSecure"value="ssl"lay-verify="required"placeholder="仅支持ssl"disabled class="layui-input"></div></div><div class="layui-form-item"><button class="layui-btn layui-btn-fluid"lay-submit lay-filter="submit11">提交并测试</button></div></form>`,success:function(){form.render();form.on("submit(submit11)",function(data){var field=data.field;$.ajax({type:"post",url:api,data:{type:"from_email",email:Cookies.get("email_cookie"),cookie:Cookies.get("login_cookie"),data:field,},success:function(s){if(s.code=="200"){layer.msg(s.message,{icon:6});location.reload(true)}else{layer.msg(s.message,{icon:5})}},});return false})},});dropdown.render({elem:"#Host",data:[{title:"smtp.qq.com"},{title:"smtp.163.com"},{title:"smtp.aliyun.com"},{title:"smtp.gmail.com"},{title:"smtp.sina.com.cn"},{title:"smtp.126.com"},{title:"smtp.foxmail.com"},{title:"smtp.139.com"},],click:function(obj,othis){this.elem.val(obj.title)},style:"width: 245px;",});dropdown.render({elem:"#Port",data:[{title:"465"},{title:"25"}],click:function(obj,othis){this.elem.val(obj.title)},style:"width: 245px;",})},});form.on("submit(submit)",function(data){var field=data.field;layer.load();layui.use("jquery",function(){var $=layui.$;$.ajax({type:"post",url:api,data:{type:"login",email:field.email,emailcode:field.emailcode},success:function(s){if(s.code=="200"){layer.msg(s.message,{icon:6});Cookies.set("login_cookie",s.cookie);Cookies.set("email_cookie",s.email);location.reload(true)}else{if(s.status=="1"){Cookies.remove("login_cookie");Cookies.remove("email.coookie");location.reload(true)}layer.msg(s.message,{icon:5})}},})});layer.closeAll("loading");return false});laydate.render({elem:"#ID-laydate-format-3",format:"yyyyMMdd"});if(login_cookie&&email_cookie){$.ajax({type:"post",url:api,data:{type:"from_value",email:email_cookie,cookie:login_cookie},success:function(s){form.val("demo-val-filter",{title:s.message.title,to_email:s.message.to_email,lovename:s.message.lovename,commemorate:s.message.commemorate,});form.val("from_email",{Host:s.from_email.Host,name:s.from_email.name,Username:s.from_email.Username,Password:s.from_email.commemorate,Port:s.from_email.Port,});Cookies.set("content",s.message.content,1)},})}else{Cookies.remove("content")}const{createEditor,createToolbar}=window.wangEditor;const editorConfig={placeholder:"请输入固定内容，可以网上找自定义html...",onChange(editor){const html=editor.getHtml();console.log("editor content",html);document.getElementById("content").innerHTML=html},};const toolbarConfig={};const editor=createEditor({selector:"#editor-container",html:Cookies.get("content"),config:editorConfig,mode:"default",});toolbarConfig.excludeKeys=["uploadImage","uploadVideo","blockquote"];const toolbar=createToolbar({editor,selector:"#toolbar-container",config:toolbarConfig,mode:"default",});console.log(toolbar.getConfig().toolbarKeys);form.on("submit(submit1)",function(data){var field=data.field;layer.load();layui.use("jquery",function(){var $=layui.$;$.ajax({type:"post",url:api,data:{type:"emailcontent",email:Cookies.get("email_cookie"),cookie:Cookies.get("login_cookie"),data:field,},success:function(s){if(s.code=="200"){layer.msg(s.message,{icon:6})}else{layer.msg(s.message,{icon:5})}},})});layer.closeAll("loading");return false})});
  </script>
</body>

</html>